package com.longteng.lesson2.domain;

import java.io.BufferedReader;
import java.io.EOFException;
import java.io.FileReader;

/**
 * Created by li
 * DATE : 2018/12/2 0002
 * TIME : 22:58
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:55324936@qq.com">li</a>
 */
public class IoUtil {
    //读取指定文件，返回内容
    FileReader fileReader =null;
    BufferedReader bufferedReader =null;
    public void initReader(){
        try {
         fileReader = new FileReader("");
         bufferedReader=new BufferedReader(fileReader);
        }catch (Exception e){

        }
    }
    public void closeReader(){
        try {
            bufferedReader.close();
            fileReader.close();
        }catch (Exception e){

        }
    }

    public String readStr(){
        StringBuffer stringBuffer=new StringBuffer();
        try {
            String s =null;
            while ((s=bufferedReader.readLine())!=null){
                stringBuffer.append(s);
            }
        }catch (Exception e){

        }
        return stringBuffer.toString();
    }
}
